<template>
	<cl-select-table
		v-model="value"
		:title="t('选择订单管理')"
		:service="service.order.order"
		:columns="columns"
		:multiple="multiple"
		:dict="{}"
		pickerType="text"
	/>
</template>

<script setup lang="ts">
defineOptions({
	name: "order-order-select",
});

import { useCool } from "/@/cool";
import { useI18n } from "vue-i18n";
import { CrudProps } from "/#/crud";
import { reactive, ref, useModel } from "vue";

const props = defineProps({
	...CrudProps,
	modelValue: null,
	multiple: Boolean,
});

const { service } = useCool();
const { t } = useI18n();

const value = useModel(props, "modelValue");

// 选项
const options = reactive({
	orderStatus: [
		{ label: t("待支付"), value: 0 },
		{ label: t("已支付"), value: 1 },
		{ label: t("已完成"), value: 2 },
		{ label: t("已取消"), value: 3 },
	],
});

const columns = ref([
	{ label: t("学员ID"), prop: "studentId", minWidth: 140 },
	{
		label: t("总金额"),
		prop: "totalAmount",
		minWidth: 140,
		sortable: "custom",
	},
	{
		label: t("优惠金额"),
		prop: "discountAmount",
		minWidth: 140,
		sortable: "custom",
	},
	{
		label: t("订单状态"),
		prop: "orderStatus",
		minWidth: 120,
		dict: options.orderStatus,
	},
	{
		label: t("支付时间"),
		prop: "payTime",
		minWidth: 170,
		sortable: "custom",
		component: { name: "cl-date-text" },
	},
]);
</script>
